<template>
  <div id="evaluation">
    <div class="dialog evaluation">
      <div class="dialog-head ">
        <h1 class="f36">请给打手(<span id="bullytx">{{orderNumRole}}</span>)打分</h1>
      </div>
      <div class="dialog-body">
        <div class="evaluation01 f30">

          <p class="evaluation01_1" style="display: block;">{{isPjredName}}</p>

        </div>
        <div class="evaluation02 f32">
          <a v-for="(list,index) in [0,1,2,3,4]" @click="startCount(index)" class="star1 pjgray" :class="{pjred:isPjred[index].isTrue}" data-value="1"></a>
          <!--<a v-for="(list,index) in [0,1,2,3,4]" @click="startCount(index)" :class="{'pjred':isPjred[index]}" class="star1 pjgray" data-value="1"></a>-->
        </div>
        <div class="evaluation03 f30">

          <p class="evaluation03_1" style="display: block;">{{isPjredWay}}</p>

        </div>
        <div class="evaluation04 f30" style="display: block;">
          <ul>
            <li @click="listClick(list,index)" :class="{active:list.active}" class="f20" v-for="(list,index) in mapTellList"><span>{{list.rateComment}}</span></li>
          </ul>
        </div>
        <div class="evaluation05 f32" style="display: block;">
          <a><div id="saveRate" @click="saveTrue">确定</div></a>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  export default{
    name:"DlDaCount",
    data(){
      return{
        hide:true,
        isPjredName:'很不满意',
        isPjredWay:'哪里出错了？',
        isIndex:1,
        mapTell:{},
        mapTellList:[],
        mapTotal:[],
        active:0,
        isPjred:[
          {
            isTrue:true,
            name:'很不满意',
            way:'哪里出错了？'
          },
          {
            isTrue:false,
            name:'不满意',
            way:'哪里出错了？'
          },
          {
            isTrue:false,
            name:'一般',
            way:'哪里出错了？'
          },
          {
            isTrue:false,
            name:'满意',
            way:'怎样做会让您更满意？'
          },
          {
            isTrue:false,
            name:'很满意',
            way:'哪些方面做得很好？'
          }
        ],

      }
    },
    props:['orderNumCount','orderNumRole','orderTypeCount'],
    methods:{
      saveTrue(){
        this.mapTellList.forEach((item,indexa)=>{
          if(item.active){
            delete(item.active)
            this.mapTotal.push(item)
          }
        })
        console.log(this.mapTotal)
        this.$http.post(this.$CONSTANTS.APIdl+"orderRate/submitOrderRate",{
          orderNum:this.orderNumCount,
          rateComments:this.mapTotal,
          rateScore:this.isIndex,
        }).then((res)=>{
          this.$router.push(
            {name: 'DlSeller',params:{state:'publish'}}
          )

//          if(res.responseStatus.code == "00"){
//            location.reload()
//          }
          this.$parent.showDlCount = false
        })

      },
      listClick(list,index){
        list.active = !list.active
        this.mapTellList.splice(index,1,list)
        console.log(list)
      },
      startCount(index){
        this.isPjred[index].isTrue = true;
        this.isPjredName = this.isPjred[index].name;
        this.isPjredWay = this.isPjred[index].way;
        console.log('------------',this.mapTell);
        this.isIndex = index+1;
      if(this.orderTypeCount==4){
        this.mapTellList = this.mapTell['4_'+(index+1)];
      }else{
        this.mapTellList = this.mapTell['5_'+(index+1)];
      }


        if(this.isPjred[index].isTrue==true){
          this.isPjred.forEach((item,indexs)=>{
            if(indexs>index){
             this.isPjred[indexs].isTrue = false
            }
            if(indexs<index){
              this.isPjred[indexs].isTrue = true
            }
          })
        }
      }
    },
    created(){

      this.$http.post(this.$CONSTANTS.APIdl+"ConfigRateComment/list",{}).then((res)=>{
        if(res.body.responseStatus.code == "00"){
         console.log(res.body.configMap)
          this.mapTell = res.body.configMap;
          if(this.orderTypeCount==4){
            this.mapTellList = this.mapTell['4_1']
          }else{
            this.mapTellList = this.mapTell['5_1']
          }

        }
      })

    }
  }
</script>
<style scoped>



</style>